<?php
/**
 * The main template file.
 *
 * @package WordPress
 * @subpackage urbanmeandering
 */

get_header();
the_post(); ?>

	
	<div id="main" class="group">
	
	<?php um_breadcrumbs(); ?>
	
		<article class="single post content">
        
        <h2 class="page-label"><span class="label">food</span><span class="right">&nbsp;</span></h2>	
				<h1 class="entry-title"><?php the_title(); ?></h1>
				<span class="entry-date">Published on <time datetime="2012-08-08"><?php the_time('F jS, Y'); ?></time></span>
				<div class="text">
					<?php the_content(); ?>
				</div>
				<?php
					$contacts = get_post_meta(get_the_ID(), '_um_contact_numbers', true);
					
					$metas = array();
				
					$metas['website']['label'] = 'Website';
					$metas['website']['value'] = get_post_meta(get_the_ID(), '_um_website', true);
					
					$metas['fb_page']['label'] = 'FB Page';
					$metas['fb_page']['value'] = get_post_meta(get_the_ID(), '_um_fb_page', true);
					
					$metas['food_menu']['label'] = 'Food Menu';
					$metas['food_menu']['value'] = get_post_meta(get_the_ID(), '_um_food_menu', true);
					
					$i=0;
				?>
        <div id="more-info" class="group">
					<div class="entry-meta" class="group">
						<ul class="group">
							<?php 
							foreach( $metas as $meta )
							{
								if( $meta['value'] )
								{
									if( is_array( $meta['value'] ) )
										$meta['value'] = implode( ', ', $meta['value'] );
									$class = ( $i % 2 == 0 ) ? 'odd' : 'even';
									$i++;
									?>
									<li class="<?php echo $class; ?>">
										<span class="meta-label"><?php echo $meta['label']; ?>:</span>
										<span class="meta-value"><?php echo popuplinks( make_clickable( $meta['value'] ) ); ?></span>
									</li>
								<?php
								}
							}
							?>
						</ul>
						<?php /*<span class="more-pictures odd">
							For more pictures, <a href="#">Visit the gallery</a>
						</span>	*/ ?>
					</div>	
					<?php $class = ( $i % 2 == 0 ) ? 'odd' : 'even'; ?>
					<div class="entry-location <?php echo $class; ?>">
						<?php 
						$location = get_post_meta( $post->ID, '_pronamic_google_maps_title', true ); 
						$address = get_post_meta( $post->ID, '_pronamic_google_maps_address', true );
						$directions = get_post_meta(get_the_ID(), '_um_directions', true);
						
						if( $location || $address || $contacts )
						{
							$i++;
							$class = $directions ? 'half' : 'full';
							?>
								<div class="address-location <?php echo $class; ?>">
								<?php
								if( $location )
								{
									?>
									<span class="venue"><label>Location:</label> <?php echo $location; ?></span>
									<?php
								}
								if( function_exists('pronamic_google_maps')) 
								{
										pronamic_google_maps(array(
												'width' => 290 ,
												'height' => 160 ,
												'static' => true ,
												'color' => '0xFFD800' ,
												'label' => 'M'
										));
								}
								
								if( $address || $contacts )
								{
								?>
									<address>
										<ul class="group">
											<?php 
											if( $address )
											{
												?>
													<li><label>Address:</label> <span><?php echo $address; ?></span></li>
												<?php
											}
											if ( $contacts )
											{ ?>
											 <li><label>Phone:</label>
												<?php  
												foreach ( $contacts as $contact )
												{
													?> 
														<span><?php echo $contact; ?></span>
													<?php 
												}
											} ?>
											</li>
										</ul>
									</address>
								<?php 
								}
								?>
								</div>
							<?php		
						}
						?>
							
						<?php
						if( $directions )
						{
							$class = ( $location || $address || $contacts ) ? 'half' : 'full';
							?>
							<div class="address-direction <?php echo $class; ?>">
								<label>Directions:</label>
								<p><?php echo $directions; ?></p>
								</div>
								<?php
						}
						?>
					</div>
					<?php $class = ( $i % 2 == 0 ) ? 'odd' : 'even'; ?>
						<div class="tags group <?php echo $class ;?>">
							<label>Tags:</label>
              <?php the_tags('<span>' ,'', '</span>' ); ?> 
						
						</div>
				</div>
                
                 
                
        	<?php comments_template( '', true ); ?>
       
		</article>
		
    <?php get_sidebar(); ?>
		
		
	</div>
	
<?php get_footer(); ?>